package com.bright.hxj.qchz.service.mq;

import com.bright.hxj.qchz.pojo.po.TaskAsync;
import com.bright.hxj.qchz.service.Duijie_ShengJieShou_QCHZManager;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

/**
 * @Author hxj
 * @Date 2025/1/7 16:11
 * @Description
 */
@Component
@RequiredArgsConstructor
//@ConditionalOnBean(value = RocketMQTemplate.class)
@ConditionalOnProperty(name = "submit-task.type", havingValue = "rocketMQ")
@Slf4j
@RocketMQMessageListener(topic = RocketMQConstant.TOPIC_CONSUMER, consumerGroup = RocketMQConstant.TOPIC_CONSUMER + "_group")
public class RocketMQConsumerServiceImpl implements RocketMQListener<TaskAsync> {

    private final Duijie_ShengJieShou_QCHZManager qchzManager;

    @Override
    public void onMessage(TaskAsync taskAsync) {
        qchzManager.processBusinessAsyncInThread(taskAsync);
    }
}
